{include file="public/head"/}
<script src="/static/Admin/js/jquery.jqprint-0.3.js"></script>
<script src="/static/Admin/js/jquery-migrate.min.js"></script>
<script language="javascript">
	$(document).ready(function () {
		// datatimepicker 设置
		$('.form_datetime').datetimepicker({
			language: 'zh-CN', // en ,zh-CN, pt-BR
			minView: 'month',
			weekStart: 0, //一周从哪一天开始
			todayBtn:  1, //
			autoclose: 1,
			todayHighlight: 1,
			startView: 2,
			forceParse: 0,
			showMeridian: 1
		});
	});
</script>
<div class="container-fluid" id="main">

<!--search框开始-->
<div class="row clearfix" id="search-box" style="display:none;margin-top:0">
    <div class="col-md-12 text-right">
        <div>
            <form class="form-inline" role="form">

                <div class="form-group">
                    <label for="name">{:lang('search_content')}</label>
                    <input type="text" class="form-control" id="name" placeholder="{:lang("please_enter_a_company_name")}" v-model="cond.searchText">
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-default btn-primary" @click="getdata"><span class="glyphicon glyphicon-search"></span>{:lang('search')}</button>
                </div>
            </form>
		</div>
	</div>
</div>

<!--search框结束-->



    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="alert alert-dismissable alert-info">
                <button type="button" class="close">×</button>
                <p></p>
            </div>
        </div>
    </div>
   
   
    <div class="ntDesktop">
    	<div class="ntDesktop-head">{:lang("list_of_purchase_contracts")}</div>
    
        <div class="row clearfix" style="padding-top:0px">
            <div class="col-md-4">
				<div class="btn-group">
                    <button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" @change="getdata()" v-model="cond.all"> {:lang('all')}</button>
                    <button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" @change="getdata()" v-model="cond.play"> {:lang("paid")}</button>
                    <button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" @change="getdata()" v-model="cond.sign"> {:lang("signed")}</button>
                    <button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" @change="getdata()" v-model="cond.receipt"> {:lang("received")}</button>
                </div>
                <button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" @change="getdata()" v-model="cond.del"> {:lang("deleted")}</button>
            </div>
            <div class="col-md-4">
            	<div class="btn-group">
	            	<button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" v-model="is_content"> {:lang("expand_display_contract_content")}</button>
                	<button type="button" class="btn btn-default btn-checkbox"><input type="checkbox" v-model="is_zwxd"> {:lang("expand_the_packing_list")}</button>
                </div>
            </div>
            <div class="col-md-4 text-right">
                <div>
                    <a href="javascript:;" class='btn btn-primary' @click="batch('batchSign')"><span class="fa fa-award"></span> {:lang("batch_signing")}</a>
                    <a href="javascript:;" class='btn btn-primary' @click="batch('batchReceipt')"><span class="fa fa-truck"></span> {:lang("receipt_in_tabches")}</a>
                    <button class='btn btn-default' @click="batch('batchDel')"><span class="glyphicon glyphicon-trash"></span> {:lang('batch_delete')}</button>
                </div>
            </div>
        </div>
        <!--startprint-->
        <div class="row clearfix" id="printArea">
            <div class="col-md-12 column">
                <table class="table table-striped table-hover ntTable" v-cloak>
                    <thead>
                        <tr>
                            <th style="text-align:center"><input type="checkbox" v-model="allche" @change="changeall" /> </th>
                            <th class="sorting" @click="storing(0,'id')"> No. </th>
                            <th class="sorting" @click="storing(0,'delivery_day')">{:lang("delivery_time/address")}  </th>
                            <th> {:lang("supplier")} </th>
                            <th> {:lang("box_quantity")} </th>
                            <th> {:lang("volume")}/{:lang("weight")} </th>
                            <th class="sorting"> {:lang('amount')}/{:lang('paid')} </th>
                            <th> {:lang("signed")} </th>
                            <th> {:lang("received")} </th>
                            <th class="sorting"> {:lang('edit')} </th>
                            <th class="text-center"> {:lang('operate')} </th>
                        </tr>
                    </thead>
                    <tbody>
                        <template  v-for="(item,index) in data">
                            <tr>
                                <td style="vertical-align:middle" class="text-center"><input type="checkbox"  value="item.id" v-model="cheval[index].val" /></td>
                                <td style="vertical-align:middle">{{item.id}}</td>
                                <td>
                                    <small>{{item.delivery_day}}</small><br>
                                    {{item.port_name}}
                                </td>
                                <td style="vertical-align:middle">{{item.company_name}}</td>
                                <td  > {{item.qty_sum}} <span class="unit">CTN</span> </td>
                                <td >
                                    {{item.m3_sum}} <span class="unit">CBM</span><br>
                                    {{item.kgs_sum}} <span class="unit">KGS</span>
                                </td>
                                <td style="text-align:center;">
                                    {{item.cost_sum+item.price_sum}} <span class="unit">CNY</span><br>
                                    {{item.paid}} <span class="unit">CNY</span>
                                </td>
                                <td style="text-align:center;">{{item.sign}}</td>
                                <td style="text-align:center;">{{item.receipt}}</td>
                                <td style="text-align:center;"> {{item.create_name}} <br /><small>{{item.create_time}} </small></td>
                                <td style="vertical-align:middle" class="text-right">
                                    <div>
                                        <a href="po_detail.html" class='btn btn-sm btn-primary'><span class="fa fa-search-plus"></span> {:lang('view')}</a>
                                        <a :href="'/admin/buypo/editBuyPo?request=edit&id='+item.id" class='btn btn-sm btn-primary'><span class="glyphicon glyphicon-pencil"></span> {:lang('edit')}</a>
                                        <a href="javascript:;" class='btn btn-sm btn-primary' @click="printf"><span class="fa fa-print"></span> {:lang("print")}</a>
                                        <a href="po_copy.html" class='btn btn-sm btn-primary'><span class="fa fa-copy"></span> {:lang('copy')}</a>
                                        <div class="btn-sm btn-group">
                                            <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown">
                                                {:lang('more_actions')}
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu text-left">
                                                <li><a href="#"><span class="fa fa-comment-dollar"></span> {:lang('payment')}</a></li>
                                                <li @click="oneaction('batchSign',item.id)"><a href="#"><span class="fa fa-award"></span> {:lang("confirm_the_contract")}</a></li>
                                                <li @click="oneaction('batchReceipt',item.id)"><a href="#"><span class="fa fa-truck"></span> {:lang("confirm_receipt_merchandise")}</a></li>
                                                <li @click="oneaction('batchDel',item.id)"><a href="#"><span class="glyphicon glyphicon-trash"></span> {:lang('delete')}</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr v-if="is_content">
                                <td colspan="2">&nbsp;</td>
                                <td colspan="9">
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>No.</th>
                                                <th>&nbsp;</th>
                                                <th>{:lang('product')}</th>
                                                <th>{:lang("quantity")}</th>
                                                <th>{:lang("box_measure")}</th>
                                                <th>{:lang("volume")}/{:lang("weight")}</th>
                                                <th>{:lang('amount')}</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr v-for="(row,index) in item.buy_plan">
                                                <td style="vertical-align:middle" align="center">{{row.id}}</td>
                                                <td style="vertical-align:middle" align="center"><img src="" border="0"></td>
                                                <td> 
                                                    <small>
                                                            {{
                                                            (row.prochar_id ? row.prochar_id : row.pro_id )
                                                            + 
                                                            (row.brand_name ? '/'+row.brand_name : '') 
                                                            +
                                                            (row.model ? '/'+row.model : '')
                                                            }}
                                                    </small> <br />
                                                    {{row.pro_name}} </td>
                                                <td > {{row.qty}} <span class="unit">CTN</span><br /> {{row.qty_sum}} <span class="unit">PCS</span></td>
                                                <td>
                                                        {{row.ctn_qty}} <span class="unit">PCS/CTN</span> | {{row.ctn_kgs}} <span class="unit">KGS/CTN</span><br>
                                                        {{row.ctn_size}} <span class="unit">CM</span> | {{row.ctn_m3}} <span class="unit">CBM/CTN</span>
                                                </td>
                                                <td>
                                                    {{row.m3_sum}} <span class="unit">CBM</span><br>
                                                    {{row.kgs_sum}} <span class="unit">KGS</span>
                                                </td>
                                                <td>
                                                        {{row.price}} <span class="unit">CNY</span><br>
                                                        {{row.price_sum}} <span class="unit">CNY</span>
                                                </td>
                                            </tr>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="2" align="center">{:lang('total')}</td>
                                                <td colspan="5" align="right">
                                                    <b>
                                                    {:lang('product')}： {{item.plan_sum}} <span class="unit">UN</span> / 
                                                    {:lang("box_quantity")}： {{item.qty_sum}} <span class="unit">CTN</span> / 
                                                    {:lang("volume")}： {{item.m3_sum}} <span class="unit">CBM</span> / 
                                                    {:lang("weight")}： {{item.kgs_sum}} <span class="unit">KGS</span> / 
                                                    {:lang('amount')}： {{item.price_sum}} <span class="unit">CNY</span>
                                                    </b>
                                                </td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </td>
                            </tr>
                            <tr v-if="is_zwxd">
                                <td colspan="2">&nbsp;</td>
                                <td colspan="9">
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>No.</th>
                                                <th>&nbsp;</th>
                                                <th>{:lang('product')}</th>
                                                <th>{:lang("quantity")}</th>
                                                <th>{:lang("box_measure")}</th>
                                                <th>{:lang("volume")}/{:lang("weight")}</th>
                                                <th>{:lang("container")}</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr v-for="(row,index) in item.buy_po_pack">
                                                    <td style="vertical-align:middle" align="center">{{row.id}}</td>
                                                    <td style="vertical-align:middle" align="center"><img src="" border="0"></td>
                                                    <td> 
                                                        <small>
                                                                {{
                                                                (row.prochar_id ? row.prochar_id : row.pro_id )
                                                                + 
                                                                (row.brand_name ? '/'+row.brand_name : '') 
                                                                +
                                                                (row.model ? '/'+row.model : '')
                                                                }}
                                                        </small> <br />
                                                        {{row.pro_name}} </td>
                                                    <td > {{row.qty}} <span class="unit">CTN</span><br /> {{row.qty_sum}} <span class="unit">PCS</span></td>
                                                    <td>
                                                            {{row.ctn_qty}} <span class="unit">PCS/CTN</span> | {{row.ctn_kgs}} <span class="unit">KGS/CTN</span><br>
                                                            {{row.ctn_size}} <span class="unit">CM</span> | {{row.ctn_m3}} <span class="unit">CBM/CTN</span>
                                                    </td>
                                                    <td>
                                                        {{row.m3_sum}} <span class="unit">CBM</span><br>
                                                        {{row.kgs_sum}} <span class="unit">KGS</span>
                                                    </td>
                                                    <td > 
                                                        {{row.name ? row.name : '未装箱'}}<br>
                                                        {{row.container_time}}.{{row.container_status}}
                                                    </td>
                                                </tr>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="2" align="center">{:lang('total')}</td>
                                                <td colspan="5" align="right">
                                                    <b>
                                                    {:lang('product')}： {{item.plan_sum}} <span class="unit">UN</span> / 
                                                    {:lang("box_quantity")}： {{item.qty_sum}} <span class="unit">CTN</span> / 
                                                    {:lang("volume")}： {{item.m3_sum}} <span class="unit">CBM</span> / 
                                                    {:lang("weight")}： {{item.kgs_sum}} <span class="unit">KGS</span> / 
                                                    </b>
                                                </td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </td>
                            </tr>
                        </template>
                    </tbody>
                </table>
            </div>
        </div>
        <!--endprint-->
    </div>
</div>

<script src="/static/Admin/js/buypo.js"></script>
{include file="public/foot"/}